package com.loooooo.pm2024.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;


public class MyFeignInterceptor implements RequestInterceptor {

    /**
     * feign调用之前进行拦截
     * 获取用户的令牌,再将令牌封装到请求头中传递到下个微服务
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {


        String token = "";
        //requestTemplate.header("token", MyabacusApplication.getToken());
        if (token != null) {
            requestTemplate.header("token", token);
        }

    }


}